﻿using System;
using System.IO;
using SurfaceAreaPresenter;

namespace SurfaceAreaInfrastructure
{
    public class FileLogger : ILogger
    {
        private const String LOG_FILE = "Logfile.txt";

        public FileLogger()
        {
            StreamWriter logFile = new StreamWriter(LOG_FILE, false);
            logFile.Close();
        }

        public void write(String log)
        {
            StreamWriter logFile = new StreamWriter(LOG_FILE, true);
            logFile.WriteLine(log);
            logFile.Close();
        }

        public String read()
        {
            StreamReader logFile = new StreamReader(LOG_FILE);
            String log = logFile.ReadToEnd();
            logFile.Close();
            return log;
        }
    }
}
